package com.jiandan.business.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jiandan.base.entity.ExtData;
import com.jiandan.base.mapper.JsonMapper;
import com.jiandan.base.utils.ExtDataUtil;
import com.jiandan.business.service.CemeteryAreaService;
import com.jiandan.business.vo.CemeteryAreaVo;

@Controller
@RequestMapping(value = "/cemeteryArea")
public class CemeteryAreaController {
	
	private static Logger logger = Logger.getLogger(CemeteryAreaController.class);
	
	@Autowired
	private CemeteryAreaService areaService;
	
	
	/** 
	 * 获取墓区信息.
	 *
	 * @param areaId the area id
	 * @return the area detail info
	 */
	@RequestMapping(value = "getAreaDetailInfo", method = RequestMethod.GET)
	@ResponseBody
	public Object getAreaDetailInfo(HttpServletRequest request, Long areaId){
		CemeteryAreaVo vo = areaService.getAreaDetailInfo(areaId);
		ExtData<CemeteryAreaVo> extData = ExtDataUtil.genWithSingleData(vo);
		String resData = JsonMapper.nonEmptyMapper().toJsonP(request.getParameter("callback"), extData);
		logger.info("获取墓区返回的JSON字符串:" + resData);
		return resData;
	}

}
